//
//  KKDemoVController.swift
//  MVVMSwfit
//
//  Created by CarShare on 2018/12/6.
//  Copyright © 2018年 CarShare. All rights reserved.
//

import UIKit

class KKDemoVController: KKBaseVController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        title = "demo \(self.navigationController?.viewControllers.count ?? 0)"
        
        view.backgroundColor = UIColor.init(red: randomColorValue(), green: randomColorValue(), blue:randomColorValue(), alpha: 1)
        
        customNaviBar.leftType = .backImage
        self.testPush()
        
        self.configTableView()
    }
    func randomColorValue() -> CGFloat {
        let random:CGFloat = CGFloat(arc4random() % 255)
        return random / 255
    }

}

extension KKDemoVController{
    func testPush() -> Void {
        let pushBtn = UIButton.init(type: .custom)
        pushBtn.frame = CGRect.init(x: 100, y: 100, width: 100, height: 100)
        pushBtn.backgroundColor = .brown
        pushBtn.addTarget(self, action: #selector(pushClick), for: .touchUpInside)
        view.addSubview(pushBtn)
    }
    @objc func pushClick() {
        let demoVC = KKDemoVController()
        self.navigationController?.pushViewController(demoVC, animated: true)
    }
}
